package com.just.just_bankreputationsystem.Mapper;

import com.just.just_bankreputationsystem.Model.Bank;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BankMapper {
    @Results({
            @Result(column ="tid",property ="type",one = @One(select ="com.just.just_bankreputationsystem.Mapper.TypeMapper.selectType"))
    })
    @Select("select * from tb_bankreputation")
    public List<Bank> show();

    @Insert("insert into tb_bankreputation values(default,#{name},#{profit},#{profitRate},#{reputation},#{appointment},#{tid})")
    int add(Bank bank);

    @Delete("delete from tb_bankreputation where id=#{id}")
    void delBank(int id);

    @Select("select * from tb_bankreputation where id=#{id}")
    Bank selectBank(int id);

    @Update("update tb_bankreputation set name=#{name},profit=#{profit},profitRate=#{profitRate},reputation=#{reputation},appointment=#{appointment},tid=#{tid} where id=#{id}")
    int update(Bank bank);
}
